package com.xc.freeapp.service.impl;

import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xc.freeapp.dao.SuggestDao;
import com.xc.freeapp.dao.dataSource.DBContextHolder;
import com.xc.freeapp.entity.Suggest;
import com.xc.freeapp.exception.BaseException;
import com.xc.freeapp.service.SuggestService;
@Service
public class SuggestServiceImpl implements SuggestService{
	private Logger log = Logger.getLogger(this.getClass());
	@Autowired
	SuggestDao suggestDao;
	public boolean saveSuggest(Suggest suggest) throws Exception{
		DBContextHolder.switchDataSourceRW();//切换数据源
		try{
			
			if(1==suggestDao.insert(suggest)){
				return true;
			}else{
				return false;
			}
		}catch(Exception e){
			e.printStackTrace();
			log.error("保存建议出错");
			throw new BaseException("PA9999");
		}
		
		
		
	}

}
